<template>
	<view class="operate u-skeleton">
		<u-navbar title="注销账号" :background="{
			'backgroundColor':'#fff'
		}" :borderBottom="false" class="u-skeleton-rect"></u-navbar>
		<view class="title">注销账号</view>

		<u-button class="btn-primary u-skeleton-rect" ripple-bg-color="rgba(0,0,0,.4)" @click="exit"
			:ripple="true">确定</u-button>
		<u-button class="btn-primary hover-btn u-skeleton-rect" ripple-bg-color="rgba(0,0,0,.4)" @click="setonone"
			:ripple="true">再想想</u-button>
		<u-skeleton :loading="loding" :animation="true" bgColor="#FFF"></u-skeleton>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//数据加载
				loding: true,
				//手机号
				username:'',
			}
		},
		onShow() {
			//获取用户数据
			this.getinfo();
		},
		methods: {
			//获取当前个人数据
			getinfo(){
				this.$http.asyncSendrequest({
					url:'/profile/userInfo',
					success:res=>{
						this.username = res.data.username;
						this.loding = false;
					}
				})
			},
			//注销账号
			exit(){
				this.$http.asyncSendrequest({
					url:'/profile/unsubscribe',
					success:res=>{
						this.$util.taost({
							title:res.msg,
							callback:v=>{
								if(res.code == '0'){
									uni.clearStorage();
									this.$util.redirectTo('/pages/login/login')
								}
							}
						})
					}
				})
			},
			//再想想
			setonone(){
				uni.navigateBack({delta:1})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.operate {
		width: 100%;
		min-height: 100vh;
		background: #FFFFFF;
		padding: 0 30rpx;
		.title{
			font-size: 36rpx;
			font-weight: bold;
			margin: 50rpx 0 30rpx;
		}
		
		
		.btn-primary {
			height: 96rpx;
			background: #292929;
			border-radius: 10rpx;
			text-align: center;
			line-height: 96rpx;
			font-size: 26rpx;
			font-family: PingFang SC;
			color: #FFFFFF;
			margin: 116rpx 0 0;
		}
		
		.hover-btn{
			background: none;
			border: 1rpx solid #292929;
			color: #292929;
			margin-top: 20rpx;
		}
	}
</style>